package com.yanu.t2s.controller;


import com.yanu.t2s.entity.Pig;
import com.yanu.t2s.service.PigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/pig")
public class PigController {
    @Autowired
    PigService pigService;

    @GetMapping("get/{pigid}")
    public Pig findByIDpig(@PathVariable int pigid){

        return pigService.findByIDpig(pigid);
    }

    @GetMapping("get/all")
    public List<Pig> findAll(){
        System.out.print("find all");
       return pigService.findAllPig();
       //return null;
    }


}
